from api_tests.base_api import BaseApi

class UserLogoutApi:
    def __init__(self):
        self.api = BaseApi()
        self.url = f"{self.api.base_url}/user/logout"
    
    def logout(self):
        """
        用户注销
        
        Returns:
            str: 格式化的响应结果
        """
        # 发送请求（需要用户权限）
        response = self.api.post(
            url=self.url,
            json={},
            auth_type="user"
        )
        
        # 解析和格式化响应
        result, error = self.api.parse_response(response)
        return self.api.format_result(result, error)

# 测试示例
if __name__ == "__main__":
    logout_api = UserLogoutApi()
    result = logout_api.logout()
    print(result)